/*
 * 
 * 
 */
package com.pclong.net;

import java.net.*;
import java.io.*;
import org.apache.log4j.LogManager;
import org.apache.log4j.Logger;

/**
 *@date 2011-11-7,22:30:13
 * @author long
 * @email 405409357@qq.com
 * @description SingleClient类
 */
public class SingleClient {

    private static final Logger logger = LogManager.getLogger(SingleClient.class);
    Socket socket;
    BufferedReader in;
    PrintWriter out;

    public SingleClient() {
        try {
            socket = new Socket("0.0.0.0", 10000);
            in = new BufferedReader(new InputStreamReader(socket.getInputStream()));
            out = new PrintWriter(socket.getOutputStream(), true);
            BufferedReader line = new BufferedReader(new InputStreamReader(System.in));
            while (true) {
                System.out.println("input your msg:");
                String input = line.readLine();
                if ("exit".equals(input)) {
                    break;
                }
                out.println(input);
            }


            line.close();
            out.close();
            in.close();
            socket.close();
        } catch (IOException e) {
            logger.debug("", e);
        }
    }

    public static void main(String[] args) {
        new SingleClient();
    }
}
